<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>选课系统-选课</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">
		<meta name="author" content="">

		<!-- Le styles -->
		<link href="resources/css/bootstrap.css" rel="stylesheet">
		<link href="resources/css/styles.css" rel="stylesheet">
		<link href="resources/css/bootstrap-responsive.css" rel="stylesheet">
		<script src="resources/js/jquery.js"></script>
		<script>
	$(function() {
		$("#pwd").blur(function() {
			$.ajax({
				url : "vertify.do",
				type : "post",
				dataType : "json",
				data : {
					"pwd" : $.trim($("#pwd").val())
				},
				success : function(json) {
					if (!json) {
						alert('输入的密码不正确！');
					}
				}
			});
		});
		$(":button").click(function() {
			var new_pwd = $("#new_pwd").val();
			var again_pwd = $("#again_pwd").val();
			if (new_pwd != again_pwd) {
				alert('两次输入的密码不符！');
			} else {
				$.ajax({
					url : "alterpwd.do",
					type : "post",
					dataType : "json",
					data : {
						"new_pwd" : $.trim($("#new_pwd").val())
					},
					success : function(json) {
						if (!json) {
							alert("修改密码失败！");
						} else {
							alert("修改密码成功！");
						}
					}
				});
			}
		});
	});
</script>

	</head>

	<body>
		<%@include file="header.jsp"%>
		<div class="container-fluid" data-isSuccess=${isSuccess}>
			<form class="form-signin" action="login.do" method="post">
				<h2 class="form-signin-heading">
					Change password
				</h2>
				<input id="schoolNo" type="text" value="admin" readonly="readonly"
					class="input-block-level">
				<input id="pwd" type="password" placeholder="Current Password"
					class="input-block-level">
				<input id="new_pwd" type="password" placeholder="New Password"
					class="input-block-level">
				<input id="again_pwd" type="password"
					placeholder="New Password Again" class="input-block-level">
				<button type="button" class="btn btn-large btn-primary">
					save
				</button>
			</form>
		</div>
	</body>
</html>